home *** CD-ROM | disk | FTP | other *** search
- Path: news.uni-stuttgart.de!schweikh
- From: schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt)
- Newsgroups: comp.infosystems.www.misc,comp.lang.misc,comp.lang.perl.misc,comp.lang.c
- Subject: Re: Perl vs.C (was Re: Unix or NT? Get a Mac!)
- Date: 4 Jan 1996 13:52:36 GMT
- Organization: Comp.Center (RUS), U of Stuttgart, FRG
- Message-ID: <4cgm34$qhg@info4.rus.uni-stuttgart.de>
- References: <4cgk4a$pje@hecate.umd.edu>
- NNTP-Posting-Host: itosun.ito.uni-stuttgart.de
-
- In article <4cgk4a$pje@hecate.umd.edu>, Ram Samudrala <me@ram.org> wrote:
- >I'm posting this on comp.lang.c, and removing c.i.w.authoring.cgi.
- >
-
- [deletia]
-
- >--Ram
-
- Because you posted this on comp.lang.c, let me hint you at the following.
- You obviously interchanged the return types of the two functions, main
- and regerr. The latter should return void, the former must return int
- according to the standard :-)
-
-
- #include <stdio.h>
-
- #define INIT register char *sp = instring;
- #define GETC() (*sp++)
- #define PEEKC() (*sp)
- #define UNGETC(c) (--sp)
- #define RETURN(c) return;
- #define ERROR(c) regerr(c)
- #define ESIZE 20000
-
- #include <regexp.h>
-
- void main(int argc, char *argv[]) /* void main, a no-no on clc */
- {
- char expbuf[ESIZE], line[200];
-
- compile(argv[1], expbuf, &expbuf[ESIZE], '\0');
- while (gets(line))
- {
- if (step(line, expbuf))
- printf("match found in %s\n", line);
- }
- }
-
- int regerr(int c)
- {
- fprintf(stderr, "regerr(): an error has occured: %d!\n", c);
- exit(0);
- }
-
- Bye, Jens
- --
- SIGSIG -- signature too long (core dumped)
-